﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Controls;
using AvalonDock;

namespace LuanVanProject
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        static public NotificationControl InfoLabel;
        static public string ProjectDirectory = "";
        static public string SystemDirectory = "C:/";
        static public bool activated = false;
        static public string currentUrl = "";
        static public ErrorViewer ErrorPanel;
        static public MindmapEditor mainMindmapEditor;
        static public List<Observer> observerList = new List<Observer>();
        static public List<ProjectPane.MindmapTag> exportMindmapList = new List<ProjectPane.MindmapTag>();
        //Main Window Component
        //public static DocumentPane Dockpane;
        static public DataLayer.MindMap currentMindmap;
        static public DocumentPane DockPane;
        static public DockingManager dockManager;
        static public DetailViewContent DetailView;
        static public DetailViewContent GlobalDetailView;
        static public ProjectWindow projWindow;
        static public MainWindow mainWindow;
        static public void Synchronize()
        {
            foreach (Observer o in observerList)
            {
                o.Update();
                App.DetailView.SetUpComboBox();
            }
        }
        protected override void OnStartup(StartupEventArgs e)
        {       
            KeyboardManager.DisableSystemKeys();
            base.OnStartup(e);
        }

        protected override void OnExit(ExitEventArgs e)
        {
            KeyboardManager.EnableSystemKeys();
            base.OnExit(e);
        }
        public static void ShowProjectWindows()
        {
            try
            {
               App.mainWindow.Visibility = Visibility.Hidden;
               App.projWindow.Visibility = Visibility.Visible;
               App.projWindow.ABSetPos();
            }
            catch
            {
                App.projWindow = new ProjectWindow();
                App.projWindow.ProjectPane.Prepare_Project_Pane();
                App.projWindow.ProjectPane.PrepareNodeTree();
                App.projWindow.ProjectPane.PrepareSystemFile();
                App.projWindow.ShowDialog();
            }
            
        }

        
    }
}
